home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / latex209 / contrib / geom / geomenv.sty (.txt) < prev    next >
LaTeX Document  |  1993-01-11  |  5KB  |  98 lines

  1. % $Header: /a/tampa/h/tampa_a/fac/levy/texts/geombook/RCS/geomenv.sty,v 1.7 92/07/17 13:44:21 levy Exp $
  2. \@ifundefined{@@newtheorem}{}{\endinput}
  3. % \newtheorem is modified so as to accept a (first) optional argument.
  4. % If this is present, the new theorem type ``foo'' will spawn an inner
  5. % environment ``foo@''.  The optional argument contains two
  6. % brace-delimited token sequences, be inserted before and after the inner
  7. % environment starts.
  8. \def\newtheorem{\@ifnextchar[{\@newtheorem}{\@newtheorem[{}{}]}}%]
  9. \long\def\@newtheorem[#1]{\@@newtheorem#1}
  10. \long\def\@@newtheorem#1#2#3{%
  11.   \newenvironment{#3}%
  12.     {\def\object@type{#3}#1\@ifnextchar[{\@enva{#3}{#2}}{\@envb{#3}{#2}}}%]
  13.     {\end{#3@}}%
  14.   \@ifnextchar[{\@othm{#3@}}{\@nnthm{#3}}%]
  15. \def\@nnthm#1#2{%
  16. \@ifnextchar[{\@xnnthm{#1}{#2}}{\@ynnthm{#1}{#2}}}
  17. \def\@xnnthm#1#2[#3]{\@definecounter{#1}\@addtoreset{#1}{#3}%
  18. \expandafter\xdef\csname the#1\endcsname{\expandafter\noexpand
  19.   \csname the#3\endcsname \@thmcountersep \@thmcounter{#1}}%
  20. \global\@namedef{#1@}{\@thm{#1}{#2}}\global\@namedef{end#1@}{\@endtheorem}}
  21. \def\@ynnthm#1#2{\@definecounter{#1}%
  22. \expandafter\xdef\csname the#1\endcsname{\@thmcounter{#1}}%
  23. \global\@namedef{#1@}{\@thm{#1}{#2}}\global\@namedef{end#1@}{\@endtheorem}}
  24. \def\@enva#1#2[#3]{\begin{#1@}[#3]#2}
  25. \def\@envb#1#2{\begin{#1@}#2}
  26. % Avoid indentation after end of theorem-like environment.
  27. \def\end#1{\csname end#1\endcsname\@checkend{#1}%
  28.   \expandafter\endgroup \if@endpe \@doendpe \@restorepar \fi
  29.   \if@ignore \global\@ignorefalse \ignorespaces\fi}
  30. % \theoremintro allows the user to choose how the theorem take is
  31. % going to look like.
  32. \def\theoremintro#1{\normalshape\bf#1}
  33. \def\@begintheorem#1#2{\trivlist\item[\hskip\labelsep{\theoremintro{#1\ #2.}}]}
  34. \def\@opargbegintheorem#1#2#3{\trivlist
  35.    \item[\hskip \labelsep{\theoremintro{#1\ #2\ (#3).}}]%
  36.    \ifautolabel\label*{#3}\fi}
  37. %  \specialdigits causes digits and punctuation to become active
  38. %  and print in roman type.  \regulardigits cancels that.
  39. \def\dowith#1{\let\@tempa#1%
  40.         \@tempa,\@tempa.\@tempa:\@tempa;\@tempa(\@tempa)%
  41.         \@tempa0\@tempa1\@tempa2\@tempa3\@tempa4%
  42.         \@tempa5\@tempa6\@tempa7\@tempa8\@tempa9}
  43. \def\makeactive#1{\catcode`#1=13}
  44. \def\makeother#1{\catcode\expandafter`\noexpand#1=12}
  45. \def\makechoice#1{\edef#1{%
  46.   \noexpand\ifmmode\string#1%
  47.   \noexpand\else\noexpand\ifhmode\/\noexpand\fi%
  48.               {\noexpand\normalshape\string#1}\noexpand\fi}}
  49. \def\regulardigits{\dowith\makeother}
  50. {\dowith\makeactive
  51. \gdef\specialdigits{%
  52. \dowith\makeactive
  53. \let\@tempa\makechoice
  54.         \@tempa,\@tempa.\@tempa:\@tempa;\@tempa(\@tempa)%
  55.         \@tempa0\@tempa1\@tempa2\@tempa3\@tempa4%
  56.         \@tempa5\@tempa6\@tempa7\@tempa8\@tempa9}%
  57. % The proof environment takes an optional argument, which defaults
  58. % to \prooftag (which should be set by theorem-like environments).
  59. % This argument is stored in \provedbox (after being passed to
  60. % \provedboxcontents), to be printed in the ``proved box'' at 
  61. % the end of the proof.  It is also printed at the beginning of proof,
  62. % after being passed to \proofintro.
  63. % If the proof
  64. % ends with a displayed formula, it is recommented that the proved box
  65. % be placed next to the formula (as if it were a tag).  This is done
  66. % by inserting \proved before the closing $$.  In even more difficult
  67. % cases (e.g., if the formula already has a tag, or is part of a 
  68. % multi-line display), plop \box\provedbox where we want the box to be.
  69. \def\prooftag{}
  70. \def\setprooftag{\xdef\prooftag{\@currentlabel}}
  71. \newenvironment{proof}
  72.   {\trivlist\item[]\@ifnextchar[{\pro@f}{\pro@f[\prooftag]}}%]
  73.   {\ifvoid\provedbox\else\hproved\fi\endtrivlist}
  74. \def\pro@f[#1]{\setbox\provedbox\hbox{\provedboxcontents{#1}}\proofintro{#1}}
  75. \def\proofintro#1{\def\@tempa{#1}%
  76.   {\it Proof\ifx\@tempa\empty\else\ of #1\fi. }\ignorespaces}
  77. \def\provedboxcontents#1{\def\@tempa{#1}%
  78.   \ifx\@tempa\empty$\square$\else\fbox{\small#1}\fi}
  79. \newbox\provedbox
  80. \def\proved{\ifmmode\eqno{\box\provedbox}\else\hproved\fi}
  81. \def\hproved{\unskip\nobreak\hfil\penalty50\hskip.5em\hbox{}\nobreak\hfil
  82.   \box\provedbox{\parfillskip=0pt\finalhyphendemerits=0\par}}
  83. % $Log:    geomenv.sty,v $
  84. %Revision 1.7  92/07/17  13:44:21  levy
  85. %*** empty log message ***
  86. %Revision 1.6  92/07/13  21:54:27  levy
  87. %further cleaned up the environments
  88. %Revision 1.5  92/07/13  11:12:10  levy
  89. %big change (abolished MakeStEnv)
  90. %Revision 1.4  92/06/15  19:15:35  levy
  91. %fixed disappearing punctuation in fancy italics
  92. %Revision 1.3  92/06/03  11:25:24  levy
  93. %active punctuation
  94. %Revision 1.2  92/04/07  09:08:56  levy
  95. %*** empty log message ***
  96. %Revision 1.1  1992/03/21  02:42:28  levy
  97. %Initial revision
  98.